import request from '@/utils/request';
import axios from "axios";

// 获取学生分页列表
export function getStudentList(params?: {
    realName?: string;
    classId?: string;
    status?: string;
    page?: number;
    pageSize?: number;
}) {
    return request.get('/api/students', { params });
}

// 获取所有活跃学生列表(用于下拉选择)
// 示例：检查getActiveStudentList实现
export const getActiveStudentList = async () => {
    try {
        const response = await axios.get('/api/students/active'); // 确保URL正确
        return response.data; // 确保返回结构正确
    } catch (error) {
        console.error('API请求失败:', error);
        throw error; // 确保错误被抛出
    }
}